<template>
  <div>
    <input v-model="num" v-test:aaa.bbb="123" type="text">
    <div v-formatNum="num">{{ num | filterNum }}</div>
  </div>
</template>
<script>
export default {
  filters: {
    filterNum(xxx) {
      return xxx + '元'
    }
  },
  directives: {
    test: {
      bind(dom, obj, vnode) {
        console.log(dom, obj, vnode)
      },
      inserted(dom) {
        dom.focus()
      }
    },
    formatNum: {
      inserted(dom, obj) {
        dom.innerText = obj.value + '美元'
      }
    }
  },
  data() {
    return {
      num: 999
    }
  }
}
</script>
<style></style>
